home *** CD-ROM | disk | FTP | other *** search
- // pane.cpp
-
- #include "pane.h"
- #include "view.h"
-
-
- //
- // constructor
- //
- pane::pane(RectangleType* in_bounds, view* in_superview)
- {
- RctCopyRectangle (in_bounds, &m_bounds);
- m_superview = in_superview;
- m_visible = true;
-
- add_to_master_list();
- }
-
- //
- // constructor
- //
- pane::pane(view* in_superview)
- {
- m_bounds.topLeft.x = 0;
- m_bounds.topLeft.y = 0;
- m_bounds.extent.x = 0;
- m_bounds.extent.y = 0;
- m_superview = in_superview;
- m_visible = true;
-
- add_to_master_list();
- }
-
- //
- // default constructor
- //
- pane::pane()
- {
- m_bounds.topLeft.x = 0;
- m_bounds.topLeft.y = 0;
- m_bounds.extent.x = 0;
- m_bounds.extent.y = 0;
- m_superview = NULL;
- m_visible = true;
- add_to_master_list();
- }
-
- //
- // destructor
- //
- pane::~pane() {
- if (m_next_pane!=NULL)
- delete m_next_pane;
- remove_from_master_list();
- }
-
-
- #pragma mark -
-
- //
- // get_superview()
- //
- view*
- pane::get_superview() {
- return m_superview;
- }
-
-
- //
- // draw()
- //
- void
- pane::draw(){
- if (m_next_pane!=NULL)
- m_next_pane->draw();
- if (m_visible)
- draw_self();
- }
-
- //
- // click()
- //
- Boolean
- pane::click(int x, int y) {
- Boolean handled = false;
-
- if ((not handled) && (m_next_pane!=NULL))
- handled = m_next_pane->click (x, y);
- if ((not handled) && RctPtInRectangle (x, y, &m_bounds) && m_visible)
- handled = click_self(x, y);
-
- return handled;
- }
-
- //
- // still_down()
- //
- Boolean
- pane::still_down(int x, int y) {
- Boolean handled = false;
-
- if (m_next_pane!=NULL)
- handled = m_next_pane->still_down (x, y);
- if (not handled && m_visible)
- handled = still_down_self(x, y);
-
- return handled;
- }
-
- //
- // pen_up()
- //
- Boolean
- pane::pen_up(int x, int y) {
- Boolean handled = false;
-
- if (m_next_pane!=NULL)
- handled = m_next_pane->pen_up (x, y);
- if (not handled && m_visible)
- handled = pen_up_self(x, y);
-
- return handled;
- }
-
- //
- // idle()
- //
- void
- pane::idle() {
- if (m_next_pane!=NULL)
- m_next_pane->idle();
- idle_self();
- }
-
- #pragma mark -
- #pragma mark Protected:
-
- //
- // draw_self()
- //
- void
- pane::draw_self() {
- // do nothing
- }
-
- //
- // click_self()
- //
- Boolean
- pane::click_self(int x, int y) {
- #pragma unused (x, y)
- // do nothing
- return false;
- }
-
- //
- // still_down_self()
- //
- Boolean
- pane::still_down_self(int x, int y) {
- #pragma unused (x, y)
- // do nothing
- return false;
- }
-
- //
- // pen_up_self()
- //
- Boolean
- pane::pen_up_self(int x, int y) {
- #pragma unused (x, y)
- // do nothing
- return false;
- }
-
- //
- // idle_self()
- //
- void
- pane::idle_self() {
- // do nothing
- }
-
- #pragma mark -
- #pragma mark Private:
-
- //
- // add_to_master_list()
- //
- void
- pane::add_to_master_list() {
- this->m_next_pane = NULL;
- if (m_superview==NULL) return;
-
- pane* p = m_superview->get_subpanes();
-
- if (p==NULL) {
- m_superview->set_subpanes(this);
- } else {
- while (p->m_next_pane != NULL) {
- p = p->m_next_pane;
- }
- p->m_next_pane = this;
- }
- }
-
- //
- // remove_from_master_list()
- //
- void
- pane::remove_from_master_list() {
- if (m_superview==NULL) return;
-
- pane* p = m_superview->get_subpanes();
- pane* next = this->m_next_pane;
-
- this->m_next_pane = NULL;
- if (p==this) {
- m_superview->set_subpanes(next);
- } else {
- while (p!=NULL) {
- if (p->m_next_pane == this) {
- p->m_next_pane = next;
- break;
- }
- p = p->m_next_pane;
- }
- }
- }
-